<docs>
  ## 编辑个人基本信息
</docs>
<template>
  <div class="wrap">
    <div class="tab-wrap">
      <div>
        <router-link :to="{ path: '/person/baseInfo/pBaseInfo'}">
        人员信息
        </router-link>
      </div>
       <div>
          <router-link :to="{ path: '/person/baseInfo/jobIntent'}">
          求职意向
          </router-link>
      </div>
      <div>
        <router-link :to="{ path: '/person/baseInfo/workHistory'}">
          工作经历
        </router-link>
      </div>
      <div>
        <router-link :to="{ path: '/person/baseInfo/schoolExper'}">
          学习经历
        </router-link>
      </div>
      <div class="active">
        <router-link :to="{ path: '/person/baseInfo/otherInfo'}">
          其他信息
        </router-link>
      </div>
    </div>
    <!-- 职业技能开始 -->
    <div class="common">
      <div class="title tem_comm">
        <p>职业技能</p>
        <div class="group">
          <i class="iconfont icon-add" @click="editLink(1,'20')"> 添加</i>
        </div>
      </div>

      <div v-for="(item, index) in zyjn" :key="index">
        <div class="point tem_comm">
          <div class="group">
            <i class="iconfont icon-delete" @click="deleteData('20',item)"> 删除</i>
            <i class="iconfont icon-edit" @click="editLink(2,'20',item)"> 编辑</i>
          </div>
          <div class="item">
            <span class="list_l">技能名称</span>
            <span class="list_r">{{item.yyjnbm_xs}}</span>
          </div>
          <div class="item">
            <span class="list_l">技能等级</span>
            <span class="list_r">{{item.jsdj_xs}}</span>
          </div>
          <div class="item">
            <span class="list_l">从事年限</span>
            <span class="list_r">{{item.csnx}}</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 语言能力开始 -->
    <div class="common">
      <div class="title tem_comm">
        <p>语言能力</p>
        <div class="group">
          <i class="iconfont icon-add" @click="editLink(1,'10')"> 添加</i>
        </div>
      </div>
      <div v-for="(item, index) in yynl" :key="index">
        <div class="point tem_comm">
          <div class="group">
            <i class="iconfont icon-delete" @click="deleteData('10',item)"> 删除</i>
            <i class="iconfont icon-edit" @click="editLink(2,'10',item)"> 编辑</i>
          </div>
          <div class="item">
            <span class="list_l">语言能力</span>
            <span class="list_r">{{item.yyjnbm_xs}}</span>
          </div>
          <div class="item">
            <span class="list_l">熟练程度</span>
            <span class="list_r">{{item.slcd_xs}}</span>
          </div>
          <div class="item">
            <span class="list_l">其他外语</span>
            <span class="list_r">{{item.xgsm}}</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 计算机开始 -->
    <div class="common">
      <div class="title tem_comm">
        <p>计算机</p>
        <div class="group">
          <i class="iconfont icon-add" @click="editLink(1,'30')"> 添加</i>
        </div>
      </div>
      <div v-for="(item, index) in jsj" :key="index">
        <div class="point tem_comm">
          <div class="group">
            <i class="iconfont icon-delete" @click="deleteData('30',item)"> 删除</i>
            <i class="iconfont icon-edit" @click="editLink(2,'30',item)"> 编辑</i>
          </div>
          <div class="item">
            <span class="list_l list_l_width">计算机等级</span>
            <span class="list_r">{{item.yyjnbm_xs}}</span>
          </div>
          <div class="item">
            <span class="list_l list_l_width">从事年限</span>
            <span class="list_r">{{item.csnx}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import $ from '@/common/js/axios';


export default {
  name: 'otherInfo',
  components: { },
  data() {
    return {
      // zyjn: [],
      jsj: [],
      yynl: [],
      zyjn: [],
      grqzid: '',
      addObj: {}
    };
  },
  methods: {
    // 获取个人简历信息
    get_jbxx() {
      this.$loading = true;
      $.get('/grgl/grxqCx').then(res => {
        const data = res.returnData;
        // this.zyjn = data.zyjn;
        this.jsj = data.jsj;
        this.yynl = data.yynl;
        this.zyjn = data.zyjn;
        this.grqzid = data.jbxx.grqzid;
        this.addObj.grqzid = data.jbxx.grqzid;
        this.addObj.jlid = data.jlid;

      }).finally(() => {
        this.$loading = false;
      });
    },
    editLink(operaFalg, lx, item) {
      if (operaFalg == 1) {
        this.addObj.yyjnlx = lx;
        this.addObj.ywcz = operaFalg;
        this.$router.push({ path:'/person/baseInfo/editotherInfo', query: this.addObj })
      } else {
        item.ywcz = operaFalg;
        item.grqzid = this.grqzid;
        this.$router.push({ path:'/person/baseInfo/editotherInfo', query: item })
      }
    },
    deleteData(lx, item) {
      item.grqzid = this.grqzid;
      item.ywcz = '0';
      this.$confirm('确定要删除吗？', '提示')
      .then(() => {
        this.$loading = true;
        this.$http.post('/url/post/grgl_zyjnBc', item).then(res => {
          const resData = res.returnData;
          this.$alert(resData.message, () => {
            this.get_jbxx();
          });
        }).finally(() => {
          this.$loading = false;
        });
      })
      .catch(() => {
        this.$toast('选择了取消');
      });
    }
  },
  created() {
    this.get_jbxx();
  }
};
</script>
<style scoped lang="scss">
@import '~common/scss/var.scss';
.wrap {
  background: $color-bg;
  .btn-wrap {
    display: flex;
    .weui-btn {
      margin: $margin-base auto;
      flex: 0 1 47%;
    }
  }
}
.point.tem_comm {
  margin-top: 20px;
  border-bottom: 1px dotted #ccc;
}
</style>
